package com.warm.orm.eq.job.agent;


import java.util.List;

import com.warm.orm.eq.job.mapper.SysJobLogMapper;
import org.noear.solon.annotation.Component;

import com.easy.query.solon.annotation.Db;
import com.warm.core.page.TableDataInfo;
import com.warm.job.api.orm.agent.SysJobLogAgent;
import com.warm.orm.utils.PageUtils;
import com.warm.orm.domain.job.SysJobLog;
import org.noear.solon.annotation.Inject;

/**
 * 调度任务日志信息 数据层 代理类
 *
 * @author hh
 */
@Component
public class SysJobLogAgentImpl implements SysJobLogAgent {
    @Inject
    private SysJobLogMapper jobLogMapper;

    /**
     * 清空任务日志
     */
    @Override
    public void cleanJobLog() {
        this.jobLogMapper.cleanJobLog();
    }

    /**
     * 删除任务日志
     *
     * @param jobId 调度日志ID
     * @return 结果
     */
    @Override
    public int deleteJobLogById(Long jobId) {
        return this.jobLogMapper.deleteJobLogById(jobId);
    }

    /**
     * 批量删除调度日志信息
     *
     * @param logIds 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteJobLogByIds(Long[] logIds) {
        return this.jobLogMapper.deleteJobLogByIds(logIds);
    }

    /**
     * 新增任务日志
     *
     * @param jobLog 调度日志信息
     * @return 结果
     */
    @Override
    public int insertJobLog(SysJobLog jobLog) {
        return this.jobLogMapper.insertJobLog(jobLog);
    }

    /**
     * 查询所有调度任务日志
     *
     * @return 调度任务日志列表
     */
    @Override
    public List<SysJobLog> selectJobLogAll() {
        return this.jobLogMapper.selectJobLogAll();
    }

    /**
     * 通过调度任务日志ID查询调度信息
     *
     * @param jobLogId 调度任务日志ID
     * @return 调度任务日志对象信息
     */
    @Override
    public SysJobLog selectJobLogById(Long jobLogId) {
        return this.jobLogMapper.selectJobLogById(jobLogId);
    }

    /**
     * 获取quartz调度器日志的计划任务
     *
     * @param jobLog 调度日志信息
     * @return 调度任务日志集合
     */
    @Override
    public List<SysJobLog> selectJobLogList(SysJobLog jobLog) {
        return this.jobLogMapper.selectJobLogList(jobLog);
    }

    /**
     * 获取quartz调度器日志的计划任务
     *
     * @param jobLog 调度日志信息
     * @return 调度任务日志集合
     */
    @Override
    public TableDataInfo<SysJobLog> selectJobLogPage(SysJobLog jobLog) {
        PageUtils.startPage();
        List<SysJobLog> list = this.jobLogMapper.selectJobLogList(jobLog);
        return PageUtils.getDataTable(list);
    }
}
